package com.houger.ddd.common.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI openApi() {
        return new OpenAPI()
                .info(new Info()
                        .title("DDD")
                        .description("领域驱动设计实践")
                        .contact(new Contact().name("Houger").email("https://gitee.com/houger/ddd-java").url("https://gitee.com/houger/ddd-java"))
                        .version("v3.0"));
    }

    @Bean
    public GroupedOpenApi redPacketApi() {
        return GroupedOpenApi.builder()
            .group("red-packet")
            .pathsToMatch("/red-packet/**")
            .build();
    }

    @Bean
    public GroupedOpenApi seckillApi() {
        return GroupedOpenApi.builder()
            .group("seckill")
            .pathsToMatch("/seckill/**")
            .build();
    }

    @Bean
    public GroupedOpenApi activityAdminApi() {
        return GroupedOpenApi.builder()
            .group("activity-admin")
            .pathsToMatch("/activity-admin/**")
            .build();
    }


}
